package cn.westv.scps.domain;

import java.io.Serializable;
import java.sql.Timestamp;
import java.util.Date;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;

import org.hibernate.annotations.GenericGenerator;

/**
 * Created by Administrator on 2017/08/09.
 */
@Entity(name = "sms_message_record")
// @Table(name = "sms_message_record", schema = "scps", catalog = "")
public class SmsMessageRecordEntity implements Serializable {
	private String smsId;
	private String mobile;
	private String content;
	private Date sendTime;
	private Integer returnCode;
	private String handleState;//0 发送成功，不需要进行处理，1表示发送失败后未进行过处理，2发送失败后已经进行过处理
	private String serialNumber;// 流水号，单条发送以“S”开头，多条发送以“M”开头

	@Id
	@Column(name = "sms_id", nullable = false, length = 32)
	@GeneratedValue(generator = "uuid")
	@GenericGenerator(name = "uuid", strategy = "uuid")
	public String getSmsId() {
		return smsId;
	}

	public void setSmsId(String smsId) {
		this.smsId = smsId;
	}

	public String getHandleState() {
		return handleState;
	}

	public void setHandleState(String handleState) {
		this.handleState = handleState;
	}

	@Basic
	@Column(name = "mobile", nullable = false, length = 16)
	public String getMobile() {
		return mobile;
	}

	public void setMobile(String mobile) {
		this.mobile = mobile;
	}

	@Basic
	@Column(name = "content", nullable = true, length = 256)
	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	@Basic
	@Column(name = "send_time", nullable = false)
	public Date getSendTime() {
		return sendTime;
	}

	public void setSendTime(Date sendTime) {
		this.sendTime = sendTime;
	}

	@Basic
	@Column(name = "return_code", nullable = true)
	public Integer getReturnCode() {
		return returnCode;
	}

	public void setReturnCode(Integer returnCode) {
		this.returnCode = returnCode;
	}

	@Basic
	@Column(name = "serial_number", nullable = true, length = 32)
	public String getSerialNumber() {
		return serialNumber;
	}

	/**
	 * 单条发送以“S”开头，多条发送以“M”开头
	 * 
	 * @param serialNumber
	 */
	public void setSerialNumber(String serialNumber) {
		this.serialNumber = serialNumber;
	}

	@Override
	public boolean equals(Object o) {
		if (this == o)
			return true;
		if (o == null || getClass() != o.getClass())
			return false;

		SmsMessageRecordEntity that = (SmsMessageRecordEntity) o;

		if (smsId != null ? !smsId.equals(that.smsId) : that.smsId != null)
			return false;
		if (mobile != null ? !mobile.equals(that.mobile) : that.mobile != null)
			return false;
		if (content != null ? !content.equals(that.content) : that.content != null)
			return false;
		if (sendTime != null ? !sendTime.equals(that.sendTime) : that.sendTime != null)
			return false;
		if (returnCode != null ? !returnCode.equals(that.returnCode) : that.returnCode != null)
			return false;
		if (serialNumber != null ? !serialNumber.equals(that.serialNumber) : that.serialNumber != null)
			return false;

		return true;
	}

	@Override
	public int hashCode() {
		int result = smsId != null ? smsId.hashCode() : 0;
		result = 31 * result + (mobile != null ? mobile.hashCode() : 0);
		result = 31 * result + (content != null ? content.hashCode() : 0);
		result = 31 * result + (sendTime != null ? sendTime.hashCode() : 0);
		result = 31 * result + (returnCode != null ? returnCode.hashCode() : 0);
		result = 31 * result + (serialNumber != null ? serialNumber.hashCode() : 0);
		return result;
	}
}
